#include <windows.h>
#include <map>

using namespace std;

namespace multithreading{

    class event{
        public:
            event();
            event(const event &e);
            ~event();
            void set();
            void reset();
            bool isSet();
            void wait(); //Waits for the event
            HANDLE h;
    };

    class mutex{
        public:
            mutex();
            mutex(const mutex &m);
            ~mutex();
            void lock();
            void unlock();
            HANDLE h;
    };

    typedef  map<void*,mutex*>            mutex_map;
    typedef  map<void*,mutex*>::iterator  mutex_iterator;
    typedef pair<void*,mutex*>            mutex_pair;

    template<typename T> void lock(T &obj);
    template<typename T> void unlock(T &obj);

};
